<template>
	<view class="goods-item">
		<!-- 左侧 -->
		<view class="goods-item-left">
			<image :src="item.goods_small_logo || defaultPic" class="goods-pic"></image>
		</view>
		<!-- 右侧 -->
		<view class="goods-item-right">
			<view class="goods-name">{{item.goods_name}}</view>

			<view class="goods-info-box">
				<view class="goods-price">
					￥{{item.goods_price |tofixed}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "my-goos",
		props: {
			item: {
				type: Object,
				defaul: {},

			}
		},
		data() {
			return {
				// 默认的空图片
				defaultPic: 'https://img3.doubanio.com/f/movie/8dd0c794499fe925ae2ae89ee30cd225750457b4/pics/movie/celebrity-default-medium.png'
			};
		},
		filters:{
			
			//使用过滤器处理商品价格保留2位小数
			tofixed(num){
				return (num).toFixed(2)
			}
		}
		
	}
</script>

<style lang="scss">
	.goods-item {
		display: flex;
		padding: 10rpx 5rpx;
		border-bottom: 1rpx solid #f0f0f0;

		.goods-item-left {
			margin-right: 5rpx;

			.goods-pic {
				width: 100rpx;
				height: 100rpx;
				display: block;
			}


		}

	}

	.goods-item-right {
		display: flex;
		flex-direction: column;
		justify-content: space-between;

		.goods-name {
			font-size: 13px;

		}
	}

	.goods-info-box {
		.goods-price {
			font-size: 16px;
			color: #ff0000;

		}
	}
</style>